<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>客户密码修改</title>
</head>
<body>
<div style="width:100%">

    <div class="container">
        <div class="comm_crub">
			    <span class="now_crub">正在操作：客户密码修改</span>
        </div>
        <div class="comm_content">

            <form id="pwd_form" class="form-horizontal" onsubmit="return false;">
                <div class="commAttr">
                    <div class="form-group">
                        <label for="pcustID" class="col-sm-2 control-label"> 客户号：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control w300" name="pcustID"  value="<!--{$pcustID}-->" disabled>
                        </div>
                        <input  type="hidden" id="pcustID" name="pcustID" value="<!--{$pcustID}-->" />
                    </div>
                    <div class="form-group">
                        <label for="custID" class="col-sm-2 control-label"> 网站用户名：</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control w500" id="custID" name="custID"  value="<!--{$custID}-->" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="oldPwd" class="col-sm-2 control-label"><span class="red">*</span> 旧密码：</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control w300" id="oldPwd" name="oldPwd" placeholder="请输入旧密码【必填项】" value="" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="newPwd" class="col-sm-2 control-label"><span class="red">*</span> 新密码：</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control w300" id="newPwd" name="newPwd" placeholder="请输入新密码【必填项】" value="" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="reNewPwd" class="col-sm-2 control-label"><span class="red">*</span> 确认密码：</label>
                        <div class="col-sm-10">
                            <input type="password" class="form-control w300" id="reNewPwd" name="reNewPwd" placeholder="请再次输入新密码【必填项】" value="" >
                        </div>
                    </div>
                </div>
            </form>

        </div>
    </div>

    <div class="popup-footer">
        <div class="rectbox tac" style="margin: 20px;">
            <input type="button" class="btn btn-success" onclick="customerPwd.check();" value="保存" />&nbsp;&nbsp;&nbsp;
            <input type="button" class="btn btn-default" onclick="E.closeWindows();" value="关闭" />
        </div>
    </div>



</div>

<script type="text/javascript">

    $().ready(function(){
        $("#oldPwd").val('');
        $("#password").val('');
    })

    var customerPwd = {

        dt: "",

        check: function() {

            this.dt = E.getFormValues("pwd_form");
            var oldPwd = $.trim( $("#oldPwd").val() );
            var newPwd = $.trim( $("#newPwd").val() );
            var reNewPwd  = $.trim( $("#reNewPwd").val() );
            var err_msg = '';

            if(oldPwd == ''){
                err_msg += '旧密码不能为空<br />';
            }else if(oldPwd.length < 6){
                err_msg += '密码长度不能小于六位<br />';
            }else if(!E.isPwd(oldPwd)){
                err_msg += '旧密码格式不正确<br />';
            }

            if(newPwd == ''){
                err_msg += '新密码不能为空<br />';
            }else if(newPwd.length < 6){
                err_msg += '密码长度不能小于六位<br />';
            }else if(!E.isPwd(newPwd)){
                err_msg += '新密码格式不正确<br />';
            }

            if(reNewPwd == ''){
                err_msg += '确认密码不能为空<br />';
            }else if(reNewPwd.length < 6){
                err_msg += '密码长度不能小于六位<br />';
            }else if(!E.isPwd(reNewPwd)){
                err_msg += '确认密码格式不正确<br />';
            }else if(reNewPwd != newPwd){
                err_msg += '两次密码输入不一致<br />';
            }

            if(err_msg != ''){
                E.alert(err_msg);
            }else{
               this.add();
            }

        },

        add: function() {
            $.ajax({
                type: "POST",
                url: "/invokingAjax-backend/customer/customer.ajax?operFlg=11",
                dataType: "JSON",
                data: this.dt,
                success: function( result_obj ) {
                    if (result_obj.code == 200) {

                        E.opener("customer.load");
                        E.alert(result_obj.message , 2 , "E.closeWindows()");

                    } else {
                        E.alert(result_obj.message);
                    }
                }
            });
        }

    };


</script>

</body>

</html>
